local skynet = require "skynet"
local mongo = require "mongo"

local CMD = {}

local mongo_client = {}

function CMD.get_client() 
	return mongo_client
end

skynet.start(function ()
	skynet.dispatch("lua", function(session, source, cmd, ...)
		local f = CMD[cmd]
		assert(f)
		skynet.ret(skynet.pack(f(...)))
	end)

	mongo_client = mongo.client{rs={{host="127.0.0.1",port=27017}}}
end)

